/**
 * 分析结果详情页面样式
 * 包含5种分析类型的详情展示样式
 */

/* 详情模态框基础样式 */
.result-detail-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.result-detail-modal.active {
    opacity: 1;
    visibility: visible;
}

.result-detail-content {
    background: white;
    border-radius: 1rem;
    max-width: 4rem;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.result-detail-modal.active .result-detail-content {
    transform: scale(1);
}

/* 详情卡片通用样式 */
.detail-card {
    background: #f8fafc;
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.detail-card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.detail-card h4 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
}

.detail-card h4 i {
    margin-right: 0.5rem;
    width: 1.25rem;
    height: 1.25rem;
}

/* 区域分析详情样式 */
.regional-detail .detail-card:nth-child(1) {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-color: #3b82f6;
}

.regional-detail .detail-card:nth-child(1) h4 {
    color: #1e40af;
}

.regional-detail .detail-card:nth-child(2) {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    border-color: #10b981;
}

.regional-detail .detail-card:nth-child(2) h4 {
    color: #047857;
}

.regional-detail .detail-card:nth-child(3) {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-color: #f59e0b;
}

.regional-detail .detail-card:nth-child(3) h4 {
    color: #d97706;
}

/* 投诉类型分析详情样式 */
.complaint-type-detail .detail-card:nth-child(1) {
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    border-color: #6366f1;
}

.complaint-type-detail .detail-card:nth-child(1) h4 {
    color: #4338ca;
}

.complaint-type-detail .detail-card:nth-child(2) {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    border-color: #10b981;
}

.complaint-type-detail .detail-card:nth-child(2) h4 {
    color: #047857;
}

.complaint-type-detail .detail-card:nth-child(3) {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-color: #f59e0b;
}

.complaint-type-detail .detail-card:nth-child(3) h4 {
    color: #d97706;
}

/* 情感分析详情样式 */
.sentiment-detail .detail-card:nth-child(1) {
    background: linear-gradient(135deg, #fce7f3 0%, #fbcfe8 100%);
    border-color: #ec4899;
}

.sentiment-detail .detail-card:nth-child(1) h4 {
    color: #be185d;
}

.sentiment-detail .detail-card:nth-child(2) {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-color: #ef4444;
}

.sentiment-detail .detail-card:nth-child(2) h4 {
    color: #dc2626;
}

.sentiment-detail .detail-card:nth-child(3) {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-color: #3b82f6;
}

.sentiment-detail .detail-card:nth-child(3) h4 {
    color: #1e40af;
}

/* 规范性分析详情样式 */
.compliance-detail .detail-card:nth-child(1) {
    background: linear-gradient(135deg, #cffafe 0%, #a5f3fc 100%);
    border-color: #06b6d4;
}

.compliance-detail .detail-card:nth-child(1) h4 {
    color: #0891b2;
}

.compliance-detail .detail-card:nth-child(2) {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    border-color: #10b981;
}

.compliance-detail .detail-card:nth-child(2) h4 {
    color: #047857;
}

.compliance-detail .detail-card:nth-child(3) {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-color: #3b82f6;
}

.compliance-detail .detail-card:nth-child(3) h4 {
    color: #1e40af;
}

/* 重复分析详情样式 */
.duplicate-detail .detail-card:nth-child(1) {
    background: linear-gradient(135deg, #fed7aa 0%, #fdba74 100%);
    border-color: #fb923c;
}

.duplicate-detail .detail-card:nth-child(1) h4 {
    color: #ea580c;
}

.duplicate-detail .detail-card:nth-child(2) {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-color: #ef4444;
}

.duplicate-detail .detail-card:nth-child(2) h4 {
    color: #dc2626;
}

.duplicate-detail .detail-card:nth-child(3) {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-color: #3b82f6;
}

.duplicate-detail .detail-card:nth-child(3) h4 {
    color: #1e40af;
}

/* 数据网格样式 */
.data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.data-item {
    background: white;
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
}

.data-item label {
    display: block;
    font-size: 0.875rem;
    color: #64748b;
    margin-bottom: 0.25rem;
}

.data-item .value {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
}

/* 可视化容器样式 */
.visualization-container {
    background: white;
    border-radius: 0.5rem;
    padding: 1rem;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e2e8f0;
}

.visualization-container canvas {
    max-width: 100%;
    height: auto;
}

/* 地图容器样式 */
.map-container {
    height: 300px;
    background: #f1f5f9;
    border-radius: 0.5rem;
    overflow: hidden;
    position: relative;
}

.map-container .leaflet-map {
    width: 100%;
    height: 100%;
}

/* 关键词云样式 */
.keyword-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
    min-height: 100px;
}

.keyword-tag {
    background: #f1f5f9;
    color: #475569;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.keyword-tag:hover {
    background: #e2e8f0;
    color: #1e293b;
    transform: translateY(-1px);
}

.keyword-tag.size-1 { font-size: 0.75rem; }
.keyword-tag.size-2 { font-size: 0.875rem; }
.keyword-tag.size-3 { font-size: 1rem; }
.keyword-tag.size-4 { font-size: 1.125rem; }
.keyword-tag.size-5 { font-size: 1.25rem; }

/* 置信度指示器样式 */
.confidence-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.confidence-bar {
    flex: 1;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, #ef4444 0%, #f59e0b 50%, #10b981 100%);
    transition: width 0.3s ease;
}

.confidence-text {
    font-size: 0.875rem;
    font-weight: 600;
    min-width: 3rem;
    text-align: right;
}

/* 状态标签样式 */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-badge.success {
    background: #dcfce7;
    color: #166534;
}

.status-badge.warning {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.error {
    background: #fee2e2;
    color: #991b1b;
}

.status-badge.info {
    background: #dbeafe;
    color: #1e40af;
}

/* 时间线样式 */
.timeline {
    position: relative;
    padding-left: 1.5rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e2e8f0;
}

.timeline-item {
    position: relative;
    margin-bottom: 1.5rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.5rem;
    top: 0.25rem;
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    background: #3b82f6;
    border: 2px solid white;
}

.timeline-content {
    background: white;
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
}

.timeline-time {
    font-size: 0.875rem;
    color: #64748b;
    margin-bottom: 0.5rem;
}

/* 加载状态样式 */
.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #64748b;
}

.loading-spinner {
    width: 2rem;
    height: 2rem;
    border: 3px solid #e2e8f0;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 空状态样式 */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #64748b;
}

.empty-state i {
    font-size: 3rem;
    color: #cbd5e1;
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 0.875rem;
    color: #64748b;
}

/* 错误状态样式 */
.error-state {
    text-align: center;
    padding: 3rem;
    color: #dc2626;
}

.error-state i {
    font-size: 3rem;
    color: #ef4444;
    margin-bottom: 1rem;
}

.error-state h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.error-state p {
    font-size: 0.875rem;
    color: #64748b;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .detail-card {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .data-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .result-detail-content {
        width: 95%;
        max-height: 95vh;
    }

    .keyword-cloud {
        gap: 0.25rem;
    }

    .keyword-tag {
        padding: 0.375rem 0.75rem;
        font-size: 0.75rem;
    }

    .timeline {
        padding-left: 1rem;
    }

    .timeline-item::before {
        left: -1rem;
        width: 0.5rem;
        height: 0.5rem;
    }
}

@media (max-width: 480px) {
    .detail-card h4 {
        font-size: 1rem;
    }

    .detail-card h4 i {
        width: 1rem;
        height: 1rem;
        margin-right: 0.375rem;
    }

    .data-item {
        padding: 0.75rem;
    }

    .data-item label {
        font-size: 0.75rem;
    }

    .data-item .value {
        font-size: 0.875rem;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

/* 打印样式 */
@media print {
    .result-detail-modal {
        position: static;
        background: white;
        width: 100%;
        height: auto;
        overflow: visible;
    }

    .result-detail-content {
        max-width: none;
        max-height: none;
        box-shadow: none;
    }

    .detail-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .visualization-container,
    .map-container {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* 无障碍样式 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
    .detail-card {
        border-width: 2px;
    }

    .keyword-tag {
        border: 1px solid currentColor;
    }
}

/* 减少动画模式 */
@media (prefers-reduced-motion: reduce) {
    .result-detail-modal,
    .result-detail-content,
    .keyword-tag,
    .confidence-fill {
        transition: none;
        animation: none;
    }

    .loading-spinner {
        animation: none;
        border-top-color: #3b82f6;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .detail-card {
        background: #1e293b;
        border-color: #334155;
    }

    .data-item {
        background: #334155;
        border-color: #475569;
    }

    .data-item label {
        color: #94a3b8;
    }

    .data-item .value {
        color: #f1f5f9;
    }

    .visualization-container,
    .map-container {
        background: #1e293b;
        border-color: #334155;
    }

    .keyword-tag {
        background: #334155;
        color: #cbd5e1;
    }

    .keyword-tag:hover {
        background: #475569;
        color: #f1f5f9;
    }

    .confidence-bar {
        background: #334155;
    }

    .timeline-content {
        background: #1e293b;
        border-color: #334155;
    }
}